Translatable

interface Translatable

Classes that implement Translatable can be automatically utilized by many FzzyConfig systems for generating translatable text in-game

Author

fzzyhmstrs

Since

0.2.0, added prefixes 0.6.0

Samples

import me.fzzyhmstrs.fzzy_config.util.Translatable

fun main() { 
   //sampleStart 
   class ExampleTranslatable: Translatable {
    override fun translationKey(): String {
        return "my.config.cool.translation"
    }

    override fun descriptionKey(): String {
        return "my.config.cool.translation.desc"
    }
} 
   //sampleEnd
}

Inheritors

Types

Link copied to clipboard
class Result(val name: Text, val desc: Text? = null, val prefix: Text? = null)

A translation result from a Translatable instance. This is generated internally, but is passed into many builder methods for config GUIs. Think of it, as the name implies, as the result of Fzzy Config generating a translation set for the relevant element.

Functions

Link copied to clipboard
open fun description(fallback: String? = null): MutableText

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.

Link copied to clipboard
abstract fun descriptionKey(): String

translation key of this Translatable's description. the "description" in-game, the descriptions Enchantment Descriptions adds to enchantment tooltips are a good example.

Link copied to clipboard

Whether this Translatable has a valid description

Link copied to clipboard
open fun hasPrefix(): Boolean

Whether this Translatable has a valid prefix

Link copied to clipboard

Whether this Translatable has a valid translation

Link copied to clipboard
open fun prefix(fallback: String? = null): MutableText

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.

Link copied to clipboard
open fun prefixKey(): String

translation key of this Translatable's inline prefix text. Unlike descriptions, which are usually displayed in-tooltips, prefixes are displayed inline in the config screen itself

Link copied to clipboard
open fun translation(fallback: String? = null): MutableText

The translated Text name from the translationKey. Falls back to the implementing classes Simple Name (non-translated)

Link copied to clipboard
abstract fun translationKey(): String

translation key of this Translatable. the "name" in-game